.class Lorg/zeam/LauncherModel$1;
.super Landroid/os/AsyncTask;
.source "LauncherModel.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lorg/zeam/LauncherModel;->loadApplications(Lorg/zeam/ApplicationsView;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/Object;",
        "Ljava/util/ArrayList",
        "<",
        "Lorg/zeam/ApplicationItemInfo;",
        ">;",
        "Ljava/util/ArrayList",
        "<",
        "Lorg/zeam/ApplicationItemInfo;",
        ">;>;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lorg/zeam/LauncherModel;

.field private final synthetic val$applicationsView:Lorg/zeam/ApplicationsView;


# direct methods
.method constructor <init>(Lorg/zeam/LauncherModel;Lorg/zeam/ApplicationsView;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 1
    iput-object p1, p0, Lorg/zeam/LauncherModel$1;->this$0:Lorg/zeam/LauncherModel;

    iput-object p2, p0, Lorg/zeam/LauncherModel$1;->val$applicationsView:Lorg/zeam/ApplicationsView;

    .line 74
    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    return-void
.end method


# virtual methods
.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/Object;

    invoke-virtual {p0, p1}, Lorg/zeam/LauncherModel$1;->doInBackground([Ljava/lang/Object;)Ljava/util/ArrayList;

    move-result-object v0

    return-object v0
.end method

.method protected varargs doInBackground([Ljava/lang/Object;)Ljava/util/ArrayList;
    .locals 12
    .parameter "arg0"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "([",
            "Ljava/lang/Object;",
            ")",
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/ApplicationItemInfo;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v11, 0x0

    .line 91
    iget-object v9, p0, Lorg/zeam/LauncherModel$1;->val$applicationsView:Lorg/zeam/ApplicationsView;

    invoke-interface {v9}, Lorg/zeam/ApplicationsView;->getLauncher()Lorg/zeam/Launcher;

    move-result-object v5

    .line 92
    .local v5, launcher:Lorg/zeam/Launcher;
    new-instance v6, Landroid/content/Intent;

    const-string v9, "android.intent.action.MAIN"

    const/4 v10, 0x0

    invoke-direct {v6, v9, v10}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 93
    .local v6, mainIntent:Landroid/content/Intent;
    const-string v9, "android.intent.category.LAUNCHER"

    invoke-virtual {v6, v9}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 95
    invoke-virtual {v5}, Lorg/zeam/Launcher;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v7

    .line 96
    .local v7, packageManager:Landroid/content/pm/PackageManager;
    invoke-virtual {v7, v6, v11}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v2

    .line 99
    .local v2, apps:Ljava/util/List;,"Ljava/util/List<Landroid/content/pm/ResolveInfo;>;"
    const/4 v4, 0x0

    .local v4, i:I
    :goto_0
    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v9

    if-lt v4, v9, :cond_0

    .line 108
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 112
    .local v1, applicationItemInfos:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ApplicationItemInfo;>;"
    const/4 v4, 0x0

    :goto_1
    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v9

    if-lt v4, v9, :cond_2

    .line 134
    new-instance v9, Lorg/zeam/ApplicationItemInfo$TitleComparator;

    invoke-direct {v9}, Lorg/zeam/ApplicationItemInfo$TitleComparator;-><init>()V

    invoke-static {v1, v9}, Ljava/util/Collections;->sort(Ljava/util/List;Ljava/util/Comparator;)V

    .line 135
    return-object v1

    .line 100
    .end local v1           #applicationItemInfos:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ApplicationItemInfo;>;"
    :cond_0
    invoke-interface {v2, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Landroid/content/pm/ResolveInfo;

    .line 101
    .local v8, resolveInfo:Landroid/content/pm/ResolveInfo;
    iget-object v9, v8, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v9, v9, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    .line 102
    invoke-virtual {v5}, Lorg/zeam/Launcher;->getApplicationContext()Landroid/content/Context;

    move-result-object v10

    invoke-virtual {v10}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v10

    .line 101
    invoke-virtual {v9, v10}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_1

    .line 104
    invoke-interface {v2, v4}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 99
    :cond_1
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 114
    .end local v8           #resolveInfo:Landroid/content/pm/ResolveInfo;
    .restart local v1       #applicationItemInfos:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ApplicationItemInfo;>;"
    :cond_2
    invoke-interface {v2, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Landroid/content/pm/ResolveInfo;

    .line 115
    .restart local v8       #resolveInfo:Landroid/content/pm/ResolveInfo;
    new-instance v3, Landroid/content/ComponentName;

    .line 116
    iget-object v9, v8, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v9, v9, Landroid/content/pm/ActivityInfo;->applicationInfo:Landroid/content/pm/ApplicationInfo;

    iget-object v9, v9, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    iget-object v10, v8, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v10, v10, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    .line 115
    invoke-direct {v3, v9, v10}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 118
    .local v3, componentName:Landroid/content/ComponentName;
    new-instance v0, Lorg/zeam/ApplicationItemInfo;

    invoke-direct {v0}, Lorg/zeam/ApplicationItemInfo;-><init>()V

    .line 119
    .local v0, applicationItemInfo:Lorg/zeam/ApplicationItemInfo;
    const-wide/16 v9, -0x1

    iput-wide v9, v0, Lorg/zeam/ApplicationItemInfo;->container:J

    .line 120
    invoke-virtual {v8, v7}, Landroid/content/pm/ResolveInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;

    move-result-object v9

    iput-object v9, v0, Lorg/zeam/ApplicationItemInfo;->title:Ljava/lang/CharSequence;

    .line 121
    iget-object v9, v0, Lorg/zeam/ApplicationItemInfo;->title:Ljava/lang/CharSequence;

    if-nez v9, :cond_3

    .line 122
    iget-object v9, v8, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v9, v9, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    iput-object v9, v0, Lorg/zeam/ApplicationItemInfo;->title:Ljava/lang/CharSequence;

    .line 125
    :cond_3
    iget-object v9, v8, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    invoke-virtual {v9, v7}, Landroid/content/pm/ActivityInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;

    move-result-object v9

    .line 124
    invoke-static {v9, v5}, Lorg/zeam/Utilities;->createIconThumbnail(Landroid/graphics/drawable/Drawable;Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v9

    iput-object v9, v0, Lorg/zeam/ApplicationItemInfo;->icon:Landroid/graphics/drawable/Drawable;

    .line 127
    iput-boolean v11, v0, Lorg/zeam/ApplicationItemInfo;->filtered:Z

    .line 128
    const/high16 v9, 0x1020

    invoke-virtual {v0, v3, v9}, Lorg/zeam/ApplicationItemInfo;->setActivity(Landroid/content/ComponentName;I)V

    .line 131
    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 112
    add-int/lit8 v4, v4, 0x1

    goto :goto_1
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 1
    check-cast p1, Ljava/util/ArrayList;

    invoke-virtual {p0, p1}, Lorg/zeam/LauncherModel$1;->onPostExecute(Ljava/util/ArrayList;)V

    return-void
.end method

.method protected onPostExecute(Ljava/util/ArrayList;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/ApplicationItemInfo;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 141
    .local p1, result:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ApplicationItemInfo;>;"
    invoke-super {p0, p1}, Landroid/os/AsyncTask;->onPostExecute(Ljava/lang/Object;)V

    .line 142
    monitor-enter p0

    .line 143
    :try_start_0
    iget-object v0, p0, Lorg/zeam/LauncherModel$1;->val$applicationsView:Lorg/zeam/ApplicationsView;

    invoke-interface {v0, p1}, Lorg/zeam/ApplicationsView;->setApplications(Ljava/util/ArrayList;)V

    .line 144
    invoke-static {p1}, Lorg/zeam/LauncherModel;->access$12(Ljava/util/ArrayList;)V

    .line 142
    monitor-exit p0

    .line 146
    return-void

    .line 142
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method protected onPreExecute()V
    .locals 2

    .prologue
    .line 80
    invoke-super {p0}, Landroid/os/AsyncTask;->onPreExecute()V

    .line 81
    invoke-static {}, Lorg/zeam/LauncherModel;->access$11()Ljava/util/ArrayList;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 82
    monitor-enter p0

    .line 83
    :try_start_0
    iget-object v0, p0, Lorg/zeam/LauncherModel$1;->val$applicationsView:Lorg/zeam/ApplicationsView;

    invoke-static {}, Lorg/zeam/LauncherModel;->access$11()Ljava/util/ArrayList;

    move-result-object v1

    invoke-interface {v0, v1}, Lorg/zeam/ApplicationsView;->setApplications(Ljava/util/ArrayList;)V

    .line 82
    monitor-exit p0

    .line 86
    :cond_0
    return-void

    .line 82
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method
